package com.oocl.scan.handler;

import com.oocl.scan.model.FieldElement;
import com.oocl.scan.model.JavaClassElement;
import com.oocl.scan.store.GlobalStore;

public class GlobalObjectHandler extends BaseHandler implements Handler {

  @Override
  public void handle(JavaClassElement javaClassElement) {
    GlobalStore globalStore = GlobalStore.getInstance();
    javaClassElement.buildFieldMap();
    if (!javaClassElement.getFieldMap().isEmpty()) {
      for (FieldElement fieldElement : javaClassElement.getFieldMap().values()) {
        if (fieldElement.getValue().trim() != null || fieldElement.getValue().trim() != "") {
          System.out.println("class, field, value " + javaClassElement.getClassName() + " " + fieldElement.getName() + " " + fieldElement.getValue());
          globalStore.AppendFieldElement(javaClassElement.getClassName() + " " + fieldElement.getName(), fieldElement);
        }

      }
    }
  }
}
